Title: SQL W3S (By-BKK) / 108 Not Null
Tags: Obsidian_to_Anki

Q: What does the NOT NULL constraint do in SQL?
A: It enforces a column to NOT accept NULL values

Q: True or False: By default, SQL columns accept NULL values.
A: True

Q: What happens if you try to insert a record without a NOT NULL column value?
A: The insert fails because the field must always contain a value

Q: How do you set a column to NOT NULL when creating a table?
A: Add NOT NULL after the column definition

Q: How do you add NOT NULL to an existing column in SQL Server?
A: Use ALTER TABLE table_name ALTER COLUMN column_name datatype NOT NULL

Q: How do you add NOT NULL to an existing column in MySQL or Oracle (old)?
A: Use ALTER TABLE table_name MODIFY COLUMN column_name datatype NOT NULL

Q: How do you add NOT NULL to an existing column in Oracle 10G and later?
A: Use ALTER TABLE table_name MODIFY column_name datatype NOT NULL

Q: Which SQL constraint forces a field to always have a value?
A: NOT NULL

Q: NOT NULL means a field must always contain a value. What is the SQL constraint name?
A: NOT NULL

Q: Fill in the blank: The __ constraint ensures that a column cannot have NULL values.
A: NOT NULL

Q: Reverse card:
NOT NULL constraint
A: Which SQL constraint enforces a column to always have a value?

Q: A field that cannot be left empty uses which constraint?
A: NOT NULL

Q: True/False: You can update a NOT NULL column with a NULL value.
A: False